<!DOCTYPE html>
<html>
<head th:replace="_header_include::frag(~{::title},~{::style},~{})">
    <title>后台管理系统</title>
    <meta charset="UTF-8">
    <style>
        .dayTimeEnd .el-form-item__label:before{display: none;}
        .days .el-form-item__error{padding-left: 165px;}
        .timeToLine{display: block;float: left;margin-right: 2px;height: 34px;line-height: 34px;}
        .el-form-item{margin-bottom: 15px;}
        .lineGrey{line-height: 37px;color:#c0c4cc; }
        .el-message-box__wrapper {
            position: fixed;
            top: 50%;
            bottom: auto;
            left: 0;
            right: 0;
            text-align: center;
            margin-top: -100px;
        }
    </style>
</head>
<body>
<div id="addOptimizeRule" class="addOptimizeRule mainPadding" style="display: none;">  
    <el-breadcrumb separator="/" class="elBreadcrumb marginB20">
        <el-breadcrumb-item>Home</el-breadcrumb-item>
        <el-breadcrumb-item>业务设置</el-breadcrumb-item>
        <el-breadcrumb-item>顾问得分计算模型</el-breadcrumb-item>
    </el-breadcrumb>
    <div class="inforTitle">{{title}}</div> 
    <el-form :model="form" :rules="rules" ref="form" :inline="true">
        <div class="borderbox padding20">
            <el-row>
                <el-col :span="12">
                    <el-form-item label="规则名称：" prop="ruleName" :label-width="formLabelWidth">
                        <el-input v-model="form.ruleName" autocomplete="off" style="width: 300px;" maxlength="50"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="业务线：" prop="businessLine" :label-width="formLabelWidth">
                        <el-select v-model="form.businessLine" :reserve-keyword=true placeholder="请选择" style="width: 300px;" :disabled="isEditSelect">
                            <el-option
                                v-for="item in businessLineArr"
                                :key="item.value"
                                :label="item.name"
                                :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>                
                <el-col :span="12">
                    <el-form-item label="规则开始时间：" prop="startTime" :label-width="formLabelWidth">
                        <el-date-picker type="datetime" placeholder="选择日期时间" v-model="form.startTime" style="width: 300px;"></el-date-picker>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="规则结束时间：" :label-width="formLabelWidth">
                        <el-date-picker type="datetime" placeholder="选择日期时间" v-model="form.endTime" style="width: 300px;"></el-date-picker>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>                
                <el-col :span="12">
                    <el-form-item label="启用状态：" prop="status" :label-width="formLabelWidth">
                        <el-radio v-model="form.status" label="1">启用</el-radio>
                        <el-radio v-model="form.status" label="0">停用</el-radio>
                    </el-form-item> 
                </el-col>                
            </el-row> 
            <!-- 1添加业绩规则 -->
            <div class="marginBottom15">
                <el-form-item label="" prop="chooseTeam1" label-width="0" style="display:inline-block;">
                    <el-button type="primary" @click="addDomain1" icon="el-icon-plus">添加业绩规则</el-button>
                </el-form-item>
                <el-form-item label="统计近" prop="days1" label-width="90px" style="display:inline-block;">
                    <el-input v-model="form.days1" autocomplete="off"></el-input>
                </el-form-item>
                <span style="display:inline-block;line-height: 35px;">天数据</span>
            </div>            
            <el-table :data="form.clueScorErulEdetailList1" style="width: 100%;margin-bottom: 20px" border>
                <el-table-column type="index" align="center" prop="rank" label="序号" width="55"></el-table-column>
                <el-table-column align="center" label="业绩范围" width="500">
                    <span style="color: #f56c6c;">*</span>
                    <template slot-scope="scope">
                        <el-form-item :prop="'clueScorErulEdetailList1.' + scope.$index + '.startNum'" :rules='rules.startNum' style="width: 130px;display: inline-block;">
                            <el-input v-model="scope.row.startNum"></el-input>
                        </el-form-item>
                        <span class="lineGrey">——</span>
                        <el-form-item :prop="'clueScorErulEdetailList1.' + scope.$index + '.endNum'" :rules='rules.endNum' style="width: 130px;display: inline-block;">
                            <!-- input值 -->
                            <el-input v-model="scope.row.endNum" ></el-input>
                            <!-- 不限按钮    -->
                            <el-button type="primary" size="mini" style="position: absolute;top: 6px;right: 4px;z-index: 2;" @click="unlimitedBtn(scope.$index, form.clueScorErulEdetailList1)" >不限</el-button>
                            <!-- 不限input -->
                            <el-input style="position: absolute;top: 0;right: 0;z-index: 1;" @focus="unlimitedIpt(scope.$index, form.clueScorErulEdetailList1)"  v-if="scope.row.unlimitedShow" v-model="scope.row.unlimited"></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="得分">
                    <template slot-scope="scope">
                        <el-form-item :prop="'clueScorErulEdetailList1.' + scope.$index + '.addScore'" :rules='rules.addScore'  style="width: 160px;margin:0 auto;height: 57px;">
                            <el-input v-model="scope.row.addScore" autocomplete="off"></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="操作">
                    <template slot-scope="scope">
                        <el-button @click.native.prevent="deleteRow(scope.$index, form.clueScorErulEdetailList1)" type="text" size="small">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <!-- 2添加单数规则 -->
            <div class="marginBottom15">
                <el-form-item label="" prop="chooseTeam2" label-width="0" style="display:inline-block;">
                    <el-button type="primary" @click="addDomain2" icon="el-icon-plus">添加单数规则</el-button>
                </el-form-item>
                <el-form-item label="统计近" prop="days2" label-width="90px" style="display:inline-block;">
                    <el-input v-model="form.days2" autocomplete="off"></el-input>
                </el-form-item>
                <span style="display:inline-block;line-height: 35px;">天数据</span>
            </div>            
            <el-table :data="form.clueScorErulEdetailList2" style="width: 100%;margin-bottom: 20px" border>
                <el-table-column type="index" align="center" prop="rank" label="序号" width="55"></el-table-column>
                <el-table-column align="center" label="单数范围" width="500">
                    <span style="color: #f56c6c;">*</span>
                    <template slot-scope="scope">
                        <el-form-item :prop="'clueScorErulEdetailList2.' + scope.$index + '.startNum'" :rules='rules.startNum' style="width: 130px;display: inline-block;">
                            <el-input v-model="scope.row.startNum"></el-input>
                        </el-form-item>
                        <span class="lineGrey">——</span>
                        <el-form-item :prop="'clueScorErulEdetailList2.' + scope.$index + '.endNum'" :rules='rules.endNum' style="width: 130px;display: inline-block;">
                            <!-- input值 -->
                            <el-input v-model="scope.row.endNum" ></el-input>
                            <!-- 不限按钮    -->
                            <el-button type="primary" size="mini" style="position: absolute;top: 6px;right: 4px;z-index: 2;" @click="unlimitedBtn(scope.$index, form.clueScorErulEdetailList2)" >不限</el-button>
                            <!-- 不限input -->
                            <el-input style="position: absolute;top: 0;right: 0;z-index: 1;" @focus="unlimitedIpt(scope.$index, form.clueScorErulEdetailList2)"  v-if="scope.row.unlimitedShow" v-model="scope.row.unlimited"></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="得分">
                    <template slot-scope="scope">
                        <el-form-item :prop="'clueScorErulEdetailList2.' + scope.$index + '.addScore'" :rules='rules.addScore'  style="width: 160px;margin:0 auto;height: 57px;">
                            <el-input v-model="scope.row.addScore" autocomplete="off"></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="操作">
                    <template slot-scope="scope">
                        <el-button @click.native.prevent="deleteRow(scope.$index, form.clueScorErulEdetailList2)" type="text" size="small">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <!-- 3添加来访率规则 -->
            <div class="marginBottom15">
                <el-form-item label="" prop="chooseTeam3" label-width="0" style="display:inline-block;">
                    <el-button type="primary" @click="addDomain3" icon="el-icon-plus">添加来访率规则</el-button>
                </el-form-item>
                <el-form-item label="统计近" prop="days3" label-width="90px" style="display:inline-block;">
                    <el-input v-model="form.days3" autocomplete="off"></el-input>
                </el-form-item>
                <span style="display:inline-block;line-height: 35px;">天数据</span>
            </div>            
            <el-table :data="form.clueScorErulEdetailList3" style="width: 100%;margin-bottom: 20px" border>
                <el-table-column type="index" align="center" prop="rank" label="序号" width="55"></el-table-column>
                <el-table-column align="center" label="来访率范围" width="500">
                    <span style="color: #f56c6c;">*</span>
                    <template slot-scope="scope">
                        <el-form-item :prop="'clueScorErulEdetailList3.' + scope.$index + '.startNum'" :rules='rules.startNum' style="width: 130px;display: inline-block;">
                            <el-input v-model="scope.row.startNum"></el-input>
                        </el-form-item>
                        <span style="line-height: 37px;">%<em style="color:#c0c4cc;margin-left: 5px;">——</em></span>
                        <el-form-item :prop="'clueScorErulEdetailList3.' + scope.$index + '.endNum'" :rules='rules.endNum' style="width: 130px;display: inline-block;">
                            <!-- input值 -->
                            <el-input v-model="scope.row.endNum" ></el-input>
                            <!-- 不限按钮    -->
                            <el-button type="primary" size="mini" style="position: absolute;top: 6px;right: 4px;z-index: 2;" @click="unlimitedBtn(scope.$index, form.clueScorErulEdetailList3)" >不限</el-button>
                            <!-- 不限input -->
                            <el-input style="position: absolute;top: 0;right: 0;z-index: 1;" @focus="unlimitedIpt(scope.$index, form.clueScorErulEdetailList3)"  v-if="scope.row.unlimitedShow" v-model="scope.row.unlimited"></el-input>
                        </el-form-item>
                        <span style="line-height: 37px;">%</span>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="得分">
                    <template slot-scope="scope">
                        <el-form-item :prop="'clueScorErulEdetailList3.' + scope.$index + '.addScore'" :rules='rules.addScore'  style="width: 160px;margin:0 auto;height: 57px;">
                            <el-input v-model="scope.row.addScore" autocomplete="off"></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="操作">
                    <template slot-scope="scope">
                        <el-button @click.native.prevent="deleteRow(scope.$index, form.clueScorErulEdetailList3)" type="text" size="small">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <!-- 4添加平均响应间隔规则 -->
            <div class="marginBottom15">
                <el-form-item label="" prop="chooseTeam4" label-width="0" style="display:inline-block;">
                    <el-button type="primary" @click="addDomain4" icon="el-icon-plus">添加平均响应间隔规则</el-button>
                </el-form-item>
                <el-form-item label="统计近" prop="days4" label-width="90px" style="display:inline-block;">
                    <el-input v-model="form.days4" autocomplete="off"></el-input>
                </el-form-item>
                <span style="display:inline-block;line-height: 35px;">天数据</span>
            </div>            
            <el-table :data="form.clueScorErulEdetailList4" style="width: 100%;margin-bottom: 20px" border>
                <el-table-column type="index" align="center" prop="rank" label="序号" width="55"></el-table-column>
                <el-table-column align="center" label="平均响应间隔范围" width="500">
                    <span style="color: #f56c6c;">*</span>
                    <template slot-scope="scope">
                        <el-form-item :prop="'clueScorErulEdetailList4.' + scope.$index + '.startNum'" :rules='rules.startNum' style="width: 130px;display: inline-block;">
                            <el-input v-model="scope.row.startNum"></el-input>
                        </el-form-item>
                        <span class="lineGrey">——</span>
                        <el-form-item :prop="'clueScorErulEdetailList4.' + scope.$index + '.endNum'" :rules='rules.endNum' style="width: 130px;display: inline-block;">
                            <!-- input值 -->
                            <el-input v-model="scope.row.endNum" ></el-input>
                            <!-- 不限按钮    -->
                            <el-button type="primary" size="mini" style="position: absolute;top: 6px;right: 4px;z-index: 2;" @click="unlimitedBtn(scope.$index, form.clueScorErulEdetailList4)" >不限</el-button>
                            <!-- 不限input -->
                            <el-input style="position: absolute;top: 0;right: 0;z-index: 1;" @focus="unlimitedIpt(scope.$index, form.clueScorErulEdetailList4)"  v-if="scope.row.unlimitedShow" v-model="scope.row.unlimited"></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="得分">
                    <template slot-scope="scope">
                        <el-form-item :prop="'clueScorErulEdetailList4.' + scope.$index + '.addScore'" :rules='rules.addScore'  style="width: 160px;margin:0 auto;height: 57px;">
                            <el-input v-model="scope.row.addScore" autocomplete="off"></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="操作">
                    <template slot-scope="scope">
                        <el-button @click.native.prevent="deleteRow(scope.$index, form.clueScorErulEdetailList4)" type="text" size="small">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <!-- 5添加通话时长规则 -->
            <div class="marginBottom15">
                <el-form-item label="" prop="chooseTeam5" label-width="0" style="display:inline-block;">
                    <el-button type="primary" @click="addDomain5" icon="el-icon-plus">添加通话时长规则</el-button>
                </el-form-item>
                <el-form-item label="统计近" prop="days5" label-width="90px" style="display:inline-block;">
                    <el-input v-model="form.days5" autocomplete="off"></el-input>
                </el-form-item>
                <span style="display:inline-block;line-height: 35px;">天数据</span>
            </div>            
            <el-table :data="form.clueScorErulEdetailList5" style="width: 100%;margin-bottom: 20px" border>
                <el-table-column type="index" align="center" prop="rank" label="序号" width="55"></el-table-column>
                <el-table-column align="center" label="通话时长范围" width="500">
                    <span style="color: #f56c6c;">*</span>
                    <template slot-scope="scope">
                        <el-form-item :prop="'clueScorErulEdetailList5.' + scope.$index + '.startNum'" :rules='rules.startNum' style="width: 130px;display: inline-block;">
                            <el-input v-model="scope.row.startNum"></el-input>
                        </el-form-item>
                        <span class="lineGrey">——</span>
                        <el-form-item :prop="'clueScorErulEdetailList5.' + scope.$index + '.endNum'" :rules='rules.endNum' style="width: 130px;display: inline-block;">
                            <!-- input值 -->
                            <el-input v-model="scope.row.endNum" ></el-input>
                            <!-- 不限按钮    -->
                            <el-button type="primary" size="mini" style="position: absolute;top: 6px;right: 4px;z-index: 2;" @click="unlimitedBtn(scope.$index, form.clueScorErulEdetailList5)" >不限</el-button>
                            <!-- 不限input -->
                            <el-input style="position: absolute;top: 0;right: 0;z-index: 1;" @focus="unlimitedIpt(scope.$index, form.clueScorErulEdetailList5)"  v-if="scope.row.unlimitedShow" v-model="scope.row.unlimited"></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="得分">
                    <template slot-scope="scope">
                        <el-form-item :prop="'clueScorErulEdetailList5.' + scope.$index + '.addScore'" :rules='rules.addScore'  style="width: 160px;margin:0 auto;height: 57px;">
                            <el-input v-model="scope.row.addScore" autocomplete="off"></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="操作">
                    <template slot-scope="scope">
                        <el-button @click.native.prevent="deleteRow(scope.$index, form.clueScorErulEdetailList5)" type="text" size="small">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <!-- 6添加跟访次数规则 -->
            <div class="marginBottom15">
                <el-form-item label="" prop="chooseTeam6" label-width="0" style="display:inline-block;">
                    <el-button type="primary" @click="addDomain6" icon="el-icon-plus">添加跟访次数规则</el-button>
                </el-form-item>
                <el-form-item label="统计近" prop="days6" label-width="90px" style="display:inline-block;">
                    <el-input v-model="form.days6" autocomplete="off"></el-input>
                </el-form-item>
                <span style="display:inline-block;line-height: 35px;">天数据</span>
            </div>            
            <el-table :data="form.clueScorErulEdetailList6" style="width: 100%;margin-bottom: 20px" border>
                <el-table-column type="index" align="center" prop="rank" label="序号" width="55"></el-table-column>
                <el-table-column align="center" label="跟访次数范围" width="500">
                    <span style="color: #f56c6c;">*</span>
                    <template slot-scope="scope">
                        <el-form-item :prop="'clueScorErulEdetailList6.' + scope.$index + '.startNum'" :rules='rules.startNum' style="width: 130px;display: inline-block;">
                            <el-input v-model="scope.row.startNum"></el-input>
                        </el-form-item>
                        <span class="lineGrey">——</span>
                        <el-form-item :prop="'clueScorErulEdetailList6.' + scope.$index + '.endNum'" :rules='rules.endNum' style="width: 130px;display: inline-block;">
                            <!-- input值 -->
                            <el-input v-model="scope.row.endNum" ></el-input>
                            <!-- 不限按钮    -->
                            <el-button type="primary" size="mini" style="position: absolute;top: 6px;right: 4px;z-index: 2;" @click="unlimitedBtn(scope.$index, form.clueScorErulEdetailList6)" >不限</el-button>
                            <!-- 不限input -->
                            <el-input style="position: absolute;top: 0;right: 0;z-index: 1;" @focus="unlimitedIpt(scope.$index, form.clueScorErulEdetailList6)"  v-if="scope.row.unlimitedShow" v-model="scope.row.unlimited"></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="得分">
                    <template slot-scope="scope">
                        <el-form-item :prop="'clueScorErulEdetailList6.' + scope.$index + '.addScore'" :rules='rules.addScore'  style="width: 160px;margin:0 auto;height: 57px;">
                            <el-input v-model="scope.row.addScore" autocomplete="off"></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="操作">
                    <template slot-scope="scope">
                        <el-button @click.native.prevent="deleteRow(scope.$index, form.clueScorErulEdetailList6)" type="text" size="small">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <!-- 7添加接通率规则 -->
            <div class="marginBottom15">
                <el-form-item label="" prop="chooseTeam7" label-width="0" style="display:inline-block;">
                    <el-button type="primary" @click="addDomain7" icon="el-icon-plus">添加接通率规则</el-button>
                </el-form-item>
                <el-form-item label="统计近" prop="days7" label-width="90px" style="display:inline-block;">
                    <el-input v-model="form.days7" autocomplete="off"></el-input>
                </el-form-item>
                <span style="display:inline-block;line-height: 35px;">天数据</span>
            </div>            
            <el-table :data="form.clueScorErulEdetailList7" style="width: 100%;margin-bottom: 20px" border>
                <el-table-column type="index" align="center" prop="rank" label="序号" width="55"></el-table-column>
                <el-table-column align="center" label="接通率范围" width="500">
                    <span style="color: #f56c6c;">*</span>
                    <template slot-scope="scope">
                        <el-form-item :prop="'clueScorErulEdetailList7.' + scope.$index + '.startNum'" :rules='rules.startNum' style="width: 130px;display: inline-block;">
                            <el-input v-model="scope.row.startNum"></el-input>
                        </el-form-item>
                        <span style="line-height: 37px;">%<em style="color:#c0c4cc;margin-left: 5px;">——</em></span>
                        <el-form-item :prop="'clueScorErulEdetailList7.' + scope.$index + '.endNum'" :rules='rules.endNum' style="width: 130px;display: inline-block;">
                            <!-- input值 -->
                            <el-input v-model="scope.row.endNum" ></el-input>
                            <!-- 不限按钮    -->
                            <el-button type="primary" size="mini" style="position: absolute;top: 6px;right: 4px;z-index: 2;" @click="unlimitedBtn(scope.$index, form.clueScorErulEdetailList7)" >不限</el-button>
                            <!-- 不限input -->
                            <el-input style="position: absolute;top: 0;right: 0;z-index: 1;" @focus="unlimitedIpt(scope.$index, form.clueScorErulEdetailList7)"  v-if="scope.row.unlimitedShow" v-model="scope.row.unlimited"></el-input>
                        </el-form-item>
                        <span style="line-height: 37px;">%</span>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="得分">
                    <template slot-scope="scope">
                        <el-form-item :prop="'clueScorErulEdetailList7.' + scope.$index + '.addScore'" :rules='rules.addScore'  style="width: 160px;margin:0 auto;height: 57px;">
                            <el-input v-model="scope.row.addScore" autocomplete="off"></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="操作">
                    <template slot-scope="scope">
                        <el-button @click.native.prevent="deleteRow(scope.$index, form.clueScorErulEdetailList7)" type="text" size="small">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <!-- 8添加有效率规则 -->
            <div class="marginBottom15">
                <el-form-item label="" prop="chooseTeam8" label-width="0" style="display:inline-block;">
                    <el-button type="primary" @click="addDomain8" icon="el-icon-plus">添加有效率规则</el-button>
                </el-form-item>
                <el-form-item label="统计近" prop="days8" label-width="90px" style="display:inline-block;">
                    <el-input v-model="form.days8" autocomplete="off"></el-input>
                </el-form-item>
                <span style="display:inline-block;line-height: 35px;">天数据</span>
            </div>            
            <el-table :data="form.clueScorErulEdetailList8" style="width: 100%;margin-bottom: 20px" border>
                <el-table-column type="index" align="center" prop="rank" label="序号" width="55"></el-table-column>
                <el-table-column align="center" label="有效率范围" width="500">
                    <span style="color: #f56c6c;">*</span>
                    <template slot-scope="scope">
                        <el-form-item :prop="'clueScorErulEdetailList8.' + scope.$index + '.startNum'" :rules='rules.startNum' style="width: 130px;display: inline-block;">
                            <el-input v-model="scope.row.startNum"></el-input>
                        </el-form-item>
                        <span style="line-height: 37px;">%<em style="color:#c0c4cc;margin-left: 5px;">——</em></span>
                        <el-form-item :prop="'clueScorErulEdetailList8.' + scope.$index + '.endNum'" :rules='rules.endNum' style="width: 130px;display: inline-block;">
                            <!-- input值 -->
                            <el-input v-model="scope.row.endNum" ></el-input>
                            <!-- 不限按钮    -->
                            <el-button type="primary" size="mini" style="position: absolute;top: 6px;right: 4px;z-index: 2;" @click="unlimitedBtn(scope.$index, form.clueScorErulEdetailList8)" >不限</el-button>
                            <!-- 不限input -->
                            <el-input style="position: absolute;top: 0;right: 0;z-index: 1;" @focus="unlimitedIpt(scope.$index, form.clueScorErulEdetailList8)"  v-if="scope.row.unlimitedShow" v-model="scope.row.unlimited"></el-input>
                        </el-form-item>
                        <span style="line-height: 37px;">%</span>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="得分">
                    <template slot-scope="scope">
                        <el-form-item :prop="'clueScorErulEdetailList8.' + scope.$index + '.addScore'" :rules='rules.addScore'  style="width: 160px;margin:0 auto;height: 57px;">
                            <el-input v-model="scope.row.addScore" autocomplete="off"></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="操作">
                    <template slot-scope="scope">
                        <el-button @click.native.prevent="deleteRow(scope.$index, form.clueScorErulEdetailList8)" type="text" size="small">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <!-- 9添加ROI规则 -->
            <div class="marginBottom15">
                <el-form-item label="" prop="chooseTeam9" label-width="0" style="display:inline-block;">
                    <el-button type="primary" @click="addDomain9" icon="el-icon-plus">添加ROI规则</el-button>
                </el-form-item>
                <el-form-item label="统计近" prop="days9" label-width="90px" style="display:inline-block;">
                    <el-input v-model="form.days9" autocomplete="off"></el-input>
                </el-form-item>
                <span style="display:inline-block;line-height: 35px;">天数据</span>
            </div>            
            <el-table :data="form.clueScorErulEdetailList9" style="width: 100%;margin-bottom: 20px" border>
                <el-table-column type="index" align="center" prop="rank" label="序号" width="55"></el-table-column>
                <el-table-column align="center" label="ROI范围" width="500">
                    <span style="color: #f56c6c;">*</span>
                    <template slot-scope="scope">
                        <el-form-item :prop="'clueScorErulEdetailList9.' + scope.$index + '.startNum'" :rules='rules.startNum' style="width: 130px;display: inline-block;">
                            <el-input v-model="scope.row.startNum"></el-input>
                        </el-form-item>
                        <span class="lineGrey">——</span>
                        <el-form-item :prop="'clueScorErulEdetailList9.' + scope.$index + '.endNum'" :rules='rules.endNum' style="width: 130px;display: inline-block;">
                            <!-- input值 -->
                            <el-input v-model="scope.row.endNum" ></el-input>
                            <!-- 不限按钮    -->
                            <el-button type="primary" size="mini" style="position: absolute;top: 6px;right: 4px;z-index: 2;" @click="unlimitedBtn(scope.$index, form.clueScorErulEdetailList9)" >不限</el-button>
                            <!-- 不限input -->
                            <el-input style="position: absolute;top: 0;right: 0;z-index: 1;" @focus="unlimitedIpt(scope.$index, form.clueScorErulEdetailList9)"  v-if="scope.row.unlimitedShow" v-model="scope.row.unlimited"></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="得分">
                    <template slot-scope="scope">
                        <el-form-item :prop="'clueScorErulEdetailList9.' + scope.$index + '.addScore'" :rules='rules.addScore'  style="width: 160px;margin:0 auto;height: 57px;">
                            <el-input v-model="scope.row.addScore" autocomplete="off"></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="操作">
                    <template slot-scope="scope">
                        <el-button @click.native.prevent="deleteRow(scope.$index, form.clueScorErulEdetailList9)" type="text" size="small">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <!-- 10添加资源价值规则 -->
            <div class="marginBottom15">
                <el-form-item label="" prop="chooseTeam10" label-width="0" style="display:inline-block;">
                    <el-button type="primary" @click="addDomain10" icon="el-icon-plus">添加资源价值规则</el-button>
                </el-form-item>
                <el-form-item label="统计近" prop="days10" label-width="90px" style="display:inline-block;">
                    <el-input v-model="form.days10" autocomplete="off"></el-input>
                </el-form-item>
                <span style="display:inline-block;line-height: 35px;">天数据</span>
            </div>            
            <el-table :data="form.clueScorErulEdetailList10" style="width: 100%;margin-bottom: 20px" border>
                <el-table-column type="index" align="center" prop="rank" label="序号" width="55"></el-table-column>
                <el-table-column align="center" label="资源价值范围" width="500">
                    <span style="color: #f56c6c;">*</span>
                    <template slot-scope="scope">
                        <el-form-item :prop="'clueScorErulEdetailList10.' + scope.$index + '.startNum'" :rules='rules.startNum' style="width: 130px;display: inline-block;">
                            <el-input v-model="scope.row.startNum"></el-input>
                        </el-form-item>
                        <span class="lineGrey">——</span>
                        <el-form-item :prop="'clueScorErulEdetailList10.' + scope.$index + '.endNum'" :rules='rules.endNum' style="width: 130px;display: inline-block;">
                            <!-- input值 -->
                            <el-input v-model="scope.row.endNum" ></el-input>
                            <!-- 不限按钮    -->
                            <el-button type="primary" size="mini" style="position: absolute;top: 6px;right: 4px;z-index: 2;" @click="unlimitedBtn(scope.$index, form.clueScorErulEdetailList10)" >不限</el-button>
                            <!-- 不限input -->
                            <el-input style="position: absolute;top: 0;right: 0;z-index: 1;" @focus="unlimitedIpt(scope.$index, form.clueScorErulEdetailList10)"  v-if="scope.row.unlimitedShow" v-model="scope.row.unlimited"></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="得分">
                    <template slot-scope="scope">
                        <el-form-item :prop="'clueScorErulEdetailList10.' + scope.$index + '.addScore'" :rules='rules.addScore'  style="width: 160px;margin:0 auto;height: 57px;">
                            <el-input v-model="scope.row.addScore" autocomplete="off"></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="操作">
                    <template slot-scope="scope">
                        <el-button @click.native.prevent="deleteRow(scope.$index, form.clueScorErulEdetailList10)" type="text" size="small">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>


            <div class="padding20 f-tac">            
                <el-button type="primary" :disabled="submitDisabled" @click="submitForm('form')">确认</el-button>
                <el-button @click="cancelForm()">取 消</el-button>
            </div> 
        </div>        
    </el-form>  
</div>
</body>
<!-- import Vue before Element -->
<div th:include="_footer_include :: #jsLib"></div>
<script th:inline="javascript">
var clueAssignRule=[[${clueAssignRule}]];//规则信息
console.log(clueAssignRule)
    var aorVM = new Vue({
        el: '#addOptimizeRule',
        data: function() {
            return {  
                isEditSelect:false,
                title:'',  
                businessLineArr:[],//业务线下拉 
                form: {
                    id:'',
                    ruleName:'',
                    startTime:'',
                    endTime:'',
                    businessLine:'',//业务线                 
                    status:"0",//默认选停用
                    days1:'',
                    days2:'',
                    days3:'',
                    days4:'',
                    days5:'',
                    days6:'',
                    days7:'',
                    days8:'',
                    days9:'',
                    days10:'',
                    clueScorErulEdetailList1: [],
                    clueScorErulEdetailList2:[],
                    clueScorErulEdetailList3:[],
                    clueScorErulEdetailList4:[],                    
                    clueScorErulEdetailList5:[],                    
                    clueScorErulEdetailList6:[],                    
                    clueScorErulEdetailList7:[],                    
                    clueScorErulEdetailList8:[],                    
                    clueScorErulEdetailList9:[],                    
                    clueScorErulEdetailList10:[],                    
                },
                formLabelWidth: '180px',
                rules:{
                    ruleName: [
                        { required: true, message: '请输入规则名称', trigger: 'blur' }
                    ],
                    businessLine: [
                       { required: true, message: '请选择业务线', trigger: 'change' }
                    ],
                    startTime: [
                        { required: true, message: '请选择规则有效开始时间', trigger: 'blur' }
                    ],
                    endTime: [
                        { required: true, message: '请选择规则有效结束时间', trigger: 'blur' }
                    ],
                    
                    status: [
                        { required: true, required: true, message: '请选择是否启用', trigger: 'change' }
                    ],            
                    // chooseTeam1: [
                    //     { validator:function(rule,value,callback){
                    //         if(aorVM.form.clueScorErulEdetailList1.length==0){
                    //             callback(new Error("请添加业绩规则"));
                    //             return;
                    //         }
                    //         callback();
                    //     }, trigger: 'change'}
                    // ],   
                    days1 : [
                        { validator:function(rule,value,callback){  
                            if(aorVM.form.clueScorErulEdetailList1.length>0 && value==""){
                                callback(new Error("请添加统计近几天"));
                            }else if(/^[0-9]*$/.test(value) == false){
                               callback(new Error("请输入正整数"));
                            }
                            callback();
                        }, trigger: 'change'}
                    ],
                    days2 : [
                        { validator:function(rule,value,callback){               
                            if(aorVM.form.clueScorErulEdetailList2.length>0 && value==""){
                                callback(new Error("请添加统计近几天"));
                            }else if(/^[0-9]*$/.test(value) == false){
                               callback(new Error("请输入正整数"));
                            }
                            callback();
                        }, trigger: 'change'}
                    ],  
                    days3 : [
                        { validator:function(rule,value,callback){               
                            if(aorVM.form.clueScorErulEdetailList3.length>0 && value==""){
                                callback(new Error("请添加统计近几天"));
                            }else if(/^[0-9]*$/.test(value) == false){
                               callback(new Error("请输入正整数"));
                            }
                            callback();
                        }, trigger: 'change'}
                    ],  
                    days4 : [
                        { validator:function(rule,value,callback){               
                            if(aorVM.form.clueScorErulEdetailList4.length>0 && value==""){
                                callback(new Error("请添加统计近几天"));
                            }else if(/^[0-9]*$/.test(value) == false){
                               callback(new Error("请输入正整数"));
                            }
                            callback();
                        }, trigger: 'change'}
                    ],                  
                    days5 : [
                        { validator:function(rule,value,callback){  
                            if(aorVM.form.clueScorErulEdetailList5.length>0 && value==""){
                                callback(new Error("请添加统计近几天"));
                            }else if(/^[0-9]*$/.test(value) == false){
                               callback(new Error("请输入正整数"));
                            }
                            callback();
                        }, trigger: 'change'}
                    ],
                    days6 : [
                        { validator:function(rule,value,callback){               
                            if(aorVM.form.clueScorErulEdetailList6.length>0 && value==""){
                                callback(new Error("请添加统计近几天"));
                            }else if(/^[0-9]*$/.test(value) == false){
                               callback(new Error("请输入正整数"));
                            }
                            callback();
                        }, trigger: 'change'}
                    ],  
                    days7 : [
                        { validator:function(rule,value,callback){               
                            if(aorVM.form.clueScorErulEdetailList7.length>0 && value==""){
                                callback(new Error("请添加统计近几天"));
                            }else if(/^[0-9]*$/.test(value) == false){
                               callback(new Error("请输入正整数"));
                            }
                            callback();
                        }, trigger: 'change'}
                    ],  
                    days8 : [
                        { validator:function(rule,value,callback){               
                            if(aorVM.form.clueScorErulEdetailList8.length>0 && value==""){
                                callback(new Error("请添加统计近几天"));
                            }else if(/^[0-9]*$/.test(value) == false){
                               callback(new Error("请输入正整数"));
                            }
                            callback();
                        }, trigger: 'change'}
                    ],                  
                    days9 : [
                        { validator:function(rule,value,callback){  
                            if(aorVM.form.clueScorErulEdetailList9.length>0 && value==""){
                                callback(new Error("请添加统计近几天"));
                            }else if(/^[0-9]*$/.test(value) == false){
                               callback(new Error("请输入正整数"));
                            }
                            callback();
                        }, trigger: 'change'}
                    ],
                    days10 : [
                        { validator:function(rule,value,callback){               
                            if(aorVM.form.clueScorErulEdetailList10.length>0 && value==""){
                                callback(new Error("请添加统计近几天"));
                            }else if(/^[0-9]*$/.test(value) == false){
                               callback(new Error("请输入正整数"));
                            }
                            callback();
                        }, trigger: 'change'}
                    ],                                    
                    startNum: [
                        { required: true, required: true, message: '范围不能为空', trigger: 'change'},
                        { validator:function(rule,value,callback){               
                            if(/^[0-9]*$/.test(value) == false){
                               callback(new Error("请输入正整数"));
                            }
                            callback();
                        }, trigger: 'change'}
                    ], 
                    endNum: [
                        { required: true, required: true, message: '范围不能为空', trigger: 'change' },
                        { validator:function(rule,value,callback){               
                            if(/^[0-9]*$/.test(value) == false&&value!=-1){
                               callback(new Error("请输入正整数"));
                            }
                            callback();
                        }, trigger: 'change'}
                    ],                    
                    addScore : [
                        { required: true, message: '请添输入得分', trigger: 'change' },
                        { validator:function(rule,value,callback){               
                            if(/^[0-9]*$/.test(value) == false){
                               callback(new Error("请输入正整数"));
                            }
                            callback();
                        }, trigger: 'change'}
                    ], 
                    
                },
                submitDisabled:false,
            }             
        },
        methods: {
            unlimitedBtn(index, rows){                
                rows[index].unlimitedShow=true 
                rows[index].unlimited="不限" 
                rows[index].unlimitedVal="-1" 
                rows[index].endNum="-1" //为了不让校验而赋的无用的值  
                console.log(rows[index].unlimited)
                console.log(rows[index].unlimitedVal)                             
                console.log(rows[index].endNum)                             
            },
            unlimitedIpt(index, rows){//点击不限input
                rows[index].unlimitedShow=false 
                rows[index].unlimited=""
                rows[index].unlimitedVal="" 
                rows[index].endNum=""                             
                console.log(rows[index].unlimited)
                console.log(rows[index].unlimitedVal)                             
                console.log(rows[index].endNum)
            },
            submitForm(form) {
                this.$refs[form].validate((valid) => {                    
                    if (valid) {
                        // 开始时间不能大约结束时间
                        var  startTime=this.form.startTime;
                        var  endTime=this.form.endTime;
                        if(endTime&&startTime>endTime){
                            this.$message({
                                message: '结束时间不允许选择早于开始时间',
                                type: 'warning'
                            });
                            return;
                        }
                        
                        var clueScorErulEdetailList=[];
                        var clueScorErulEdetailList1=this.form.clueScorErulEdetailList1;
                        var clueScorErulEdetailList2=this.form.clueScorErulEdetailList2;
                        var clueScorErulEdetailList3=this.form.clueScorErulEdetailList3;
                        var clueScorErulEdetailList4=this.form.clueScorErulEdetailList4;
                        var clueScorErulEdetailList5=this.form.clueScorErulEdetailList5;
                        var clueScorErulEdetailList6=this.form.clueScorErulEdetailList6;
                        var clueScorErulEdetailList7=this.form.clueScorErulEdetailList7;
                        var clueScorErulEdetailList8=this.form.clueScorErulEdetailList8;
                        var clueScorErulEdetailList9=this.form.clueScorErulEdetailList9;
                        var clueScorErulEdetailList10=this.form.clueScorErulEdetailList10;

                        var days1=this.form.days1;
                        var days2=this.form.days2;
                        var days3=this.form.days3;
                        var days4=this.form.days4;
                        var days5=this.form.days5;
                        var days6=this.form.days6;
                        var days7=this.form.days7;
                        var days8=this.form.days8;
                        var days9=this.form.days9;
                        var days10=this.form.days10;

                        for(var i=0;i<clueScorErulEdetailList1.length;i++){
                            clueScorErulEdetailList1[i].days=days1
                        }
                        for(var i=0;i<clueScorErulEdetailList2.length;i++){
                            clueScorErulEdetailList2[i].days=days2
                        }
                        for(var i=0;i<clueScorErulEdetailList3.length;i++){
                            clueScorErulEdetailList3[i].days=days3
                        }
                        for(var i=0;i<clueScorErulEdetailList4.length;i++){
                            clueScorErulEdetailList4[i].days=days4
                        }
                        for(var i=0;i<clueScorErulEdetailList5.length;i++){
                            clueScorErulEdetailList5[i].days=days5
                        }
                        for(var i=0;i<clueScorErulEdetailList6.length;i++){
                            clueScorErulEdetailList6[i].days=days6
                        }
                        for(var i=0;i<clueScorErulEdetailList7.length;i++){
                            clueScorErulEdetailList7[i].days=days7
                        }
                        for(var i=0;i<clueScorErulEdetailList8.length;i++){
                            clueScorErulEdetailList8[i].days=days8
                        }
                        for(var i=0;i<clueScorErulEdetailList9.length;i++){
                            clueScorErulEdetailList9[i].days=days9
                        }
                        for(var i=0;i<clueScorErulEdetailList10.length;i++){
                            clueScorErulEdetailList10[i].days=days10
                        }

                        clueScorErulEdetailList= clueScorErulEdetailList.concat(clueScorErulEdetailList1).concat(clueScorErulEdetailList2).concat(clueScorErulEdetailList3).concat(clueScorErulEdetailList4).concat(clueScorErulEdetailList5).concat(clueScorErulEdetailList6).concat(clueScorErulEdetailList7).concat(clueScorErulEdetailList8).concat(clueScorErulEdetailList9).concat(clueScorErulEdetailList10) ;

                        var param={};
                        // 判断是否有id
                        var idVal=this.getQueryString("id");
                        var url="";
                        if(idVal){
                            param.id=idVal;
                            url="/rule/userScoreRule/update"
                        }else{
                            url='/rule/userScoreRule/save';
                        }
                        param.ruleName=this.form.ruleName;
                        param.businessLine=this.form.businessLine;
                        param.startTime=this.form.startTime;
                        param.endTime=this.form.endTime;
                        param.status=this.form.status;
                        param.userScoreRuleDetailList=clueScorErulEdetailList;                        
                        
                        aorVM.submitDisabled=true;
                        // 判断是否选择的启用
                        if(this.form.status=="1"){
                            var param1={};
                            if(idVal){
                                param1.id=idVal;
                            }
                            param1.status=this.form.status;
                            param1.businessLine=this.form.businessLine;
                            axios.post('/rule/userScoreRule/getRuleByBusinessLine', param1)
                            .then(function (response) {
                                var result =  response.data;
                                if(result.code=="0"){
                                    if(result.data==true){
                                        aorVM.ajaxFunction(url, param)
                                    }else{
                                        aorVM.$confirm('同业务线仅允许启用一条规则，是否停用原规则?', '提示', {
                                            confirmButtonText: '确定',
                                            cancelButtonText: '取消',
                                            type: 'warning'
                                        }).then(() => {
                                            aorVM.ajaxFunction(url, param)
                                        }).catch(() => {
                                            aorVM.$message({
                                                type: 'info',
                                                message: '已取消操作'
                                            }); 
                                            aorVM.submitDisabled=false;         
                                        });
                                    }                        
                                }else{
                                    aorVM.$message.error(result.msg+"失败");
                                    aorVM.submitDisabled=false;
                                }
                            })
                            .catch(function (error) {
                                console.log(error);
                                aorVM.submitDisabled=false;
                            }); 
                        }else{
                            aorVM.ajaxFunction(url, param)
                        }
                        
                    } else {
                        console.log('error submit!!');
                        return false;
                    }
                });
            },
            ajaxFunction(url, param){
                axios.post(url, param)
                .then(function (response) {
                    var data =response.data;
                    if(data.code!="0"){
                        aorVM.$message({message:data.msg,type:'error'});
                        aorVM.submitDisabled=false;
                    }else{
                        aorVM.$message({message:'提交成功',type:'success',duration:1000,onClose:function(){
                            aorVM.submitDisabled=false;
                            document.location.href='/rule/userScoreRule/userScoreRulePage';
                        }});
                    }
                })
                .catch(function (error) {
                    aorVM.submitDisabled=false;
                    console.log(error);
                });
            },
            deleteRow(index, rows) {//删除一行表格
                rows.splice(index, 1);
            },            
            addDomain1() {
                var list=this.form.clueScorErulEdetailList1
                if(list.length==5){
                    this.$message({
                        message: '同一指标阶梯设置不允许超过5个',
                        type: 'warning'
                    });
                    return;
                }
                this.form.clueScorErulEdetailList1.push({
                    startNum:'',
                    endNum:'',
                    addScore:'',
                    unlimited:'',//不限层
                    unlimitedVal:'',//不限层取值
                    unlimitedShow:false,//默认不显示
                    type:1,//业绩金额
                });                
            },
            addDomain2() {
                var list=this.form.clueScorErulEdetailList2
                if(list.length==5){
                    this.$message({
                        message: '同一指标阶梯设置不允许超过5个',
                        type: 'warning'
                    });
                    return;
                }
                this.form.clueScorErulEdetailList2.push({
                    startNum:'',
                    endNum:'',
                    addScore:'',
                    unlimited:'',//不限层
                    unlimitedVal:'',//不限层取值
                    unlimitedShow:false,//默认不显示
                    type:2,//单数
                });                
            },
            addDomain3() {
                var list=this.form.clueScorErulEdetailList3
                if(list.length==5){
                    this.$message({
                        message: '同一指标阶梯设置不允许超过5个',
                        type: 'warning'
                    });
                    return;
                }
                this.form.clueScorErulEdetailList3.push({
                    startNum:'',
                    endNum:'',
                    addScore:'',
                    unlimited:'',//不限层
                    unlimitedVal:'',//不限层取值
                    unlimitedShow:false,//默认不显示
                    type:3,//来访率 
                });                
            },
            addDomain4() {
                var list=this.form.clueScorErulEdetailList4
                if(list.length==5){
                    this.$message({
                        message: '同一指标阶梯设置不允许超过5个',
                        type: 'warning'
                    });
                    return;
                }
                this.form.clueScorErulEdetailList4.push({
                    startNum:'',
                    endNum:'',
                    addScore:'',
                    unlimited:'',//不限层
                    unlimitedVal:'',//不限层取值
                    unlimitedShow:false,//默认不显示
                    type:4,//平均响应间隔
                });                
            },
            addDomain5() {
                var list=this.form.clueScorErulEdetailList5
                if(list.length==5){
                    this.$message({
                        message: '同一指标阶梯设置不允许超过5个',
                        type: 'warning'
                    });
                    return;
                }
                this.form.clueScorErulEdetailList5.push({
                    startNum:'',
                    endNum:'',
                    addScore:'',
                    unlimited:'',//不限层
                    unlimitedVal:'',//不限层取值
                    unlimitedShow:false,//默认不显示
                    type:5,//通话时长
                });                
            },
            addDomain6() {
                var list=this.form.clueScorErulEdetailList6
                if(list.length==5){
                    this.$message({
                        message: '同一指标阶梯设置不允许超过5个',
                        type: 'warning'
                    });
                    return;
                }
                this.form.clueScorErulEdetailList6.push({
                    startNum:'',
                    endNum:'',
                    addScore:'',
                    unlimited:'',//不限层
                    unlimitedVal:'',//不限层取值
                    unlimitedShow:false,//默认不显示
                    type:6,//跟访次数
                });                
            },
            addDomain7() {
                var list=this.form.clueScorErulEdetailList7
                if(list.length==5){
                    this.$message({
                        message: '同一指标阶梯设置不允许超过5个',
                        type: 'warning'
                    });
                    return;
                }
                this.form.clueScorErulEdetailList7.push({
                    startNum:'',
                    endNum:'',
                    addScore:'',
                    unlimited:'',//不限层
                    unlimitedVal:'',//不限层取值
                    unlimitedShow:false,//默认不显示
                    type:7,//接通率
                });                
            },
            addDomain8() {
                var list=this.form.clueScorErulEdetailList8
                if(list.length==5){
                    this.$message({
                        message: '同一指标阶梯设置不允许超过5个',
                        type: 'warning'
                    });
                    return;
                }
                this.form.clueScorErulEdetailList8.push({
                    startNum:'',
                    endNum:'',
                    addScore:'',
                    unlimited:'',//不限层
                    unlimitedVal:'',//不限层取值
                    unlimitedShow:false,//默认不显示
                    type:8,//有效率
                });                
            },
            addDomain9() {
                var list=this.form.clueScorErulEdetailList9
                if(list.length==5){
                    this.$message({
                        message: '同一指标阶梯设置不允许超过5个',
                        type: 'warning'
                    });
                    return;
                }
                this.form.clueScorErulEdetailList9.push({
                    startNum:'',
                    endNum:'',
                    addScore:'',
                    unlimited:'',//不限层
                    unlimitedVal:'',//不限层取值
                    unlimitedShow:false,//默认不显示
                    type:9,//roi 
                });                
            },
            addDomain10() {
                var list=this.form.clueScorErulEdetailList10
                if(list.length==5){
                    this.$message({
                        message: '同一指标阶梯设置不允许超过5个',
                        type: 'warning'
                    });
                    return;
                }
                this.form.clueScorErulEdetailList10.push({
                    startNum:'',
                    endNum:'',
                    addScore:'',
                    unlimited:'',//不限层
                    unlimitedVal:'',//不限层取值
                    unlimitedShow:false,//默认不显示
                    type:10,//资源价值
                });                
            },
            cancelForm(){
                document.location.href='/rule/userScoreRule/userScoreRulePage';
            },
            initBusinessline(){//初始化业务线
                var param = {};
                axios.post('/rule/userScoreRule/getBusinesslineList', param).then(function (response) {
                    // console.log(response)
                    aorVM.businessLineArr = response.data;
                });
            },
            getQueryString(name){//获取url地址栏参数的方法
                var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
                var r = window.location.search.substr(1).match(reg);
                if(r!=null)return  unescape(r[2]); return null;
            },
            parseTime(timestamp){
                var date = new Date(timestamp);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
                var Y = date.getFullYear() + '-';
                var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
                var D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' ';
                var h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':';
                var m = (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) + ':';
                var s = (date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds());

                let strDate = Y+M+D+h+m+s;
                console.log(strDate) //2020-05-08 17:44:56　
                return strDate;
            },
            initPageInfo(){
                var id=this.getQueryString("id");
                console.log(id)
                if(id){
                    this.title="编辑顾问得分模型";
                    this.isEditSelect=true;
                    var param={};
                    param.id=id;
                    axios.post('/rule/userScoreRule/getRuleDetailById', param)
                    .then(function (response) {
                        var result =  response.data;
                        if(result.code=="0"){
                            var tableData=result.data;
                            if(tableData.ruleName){
                               aorVM.form.ruleName=tableData.ruleName; 
                            }else{
                                aorVM.form.ruleName=""
                            }
                            if(tableData.businessLine){
                                aorVM.form.businessLine=tableData.businessLine+'';
                            }else{
                                aorVM.form.businessLine=""
                            }

                            if(tableData.startTime){
                                aorVM.form.startTime=new Date(aorVM.parseTime(Number(tableData.startTime)));
                            } 
                            if(tableData.endTime){
                                aorVM.form.endTime=new Date(aorVM.parseTime(Number(tableData.endTime)));
                            }
                            aorVM.form.status=tableData.status+'';
                            
                            
                            var list1=[],list2=[],list3=[],list4=[],list5=[],list6=[],list7=[],list8=[],list9=[],list10=[];
                            var list=tableData.userScoreRuleDetailList;
                            for(var i=0;i<list.length;i++){
                                if(list[i].type==1){
                                    list1.push(list[i])
                                }
                                if(list[i].type==2){
                                    list2.push(list[i])
                                }
                                if(list[i].type==3){
                                    list3.push(list[i])
                                }
                                if(list[i].type==4){
                                    list4.push(list[i])
                                }
                                if(list[i].type==5){
                                    list5.push(list[i])
                                }
                                if(list[i].type==6){
                                    list6.push(list[i])
                                }
                                if(list[i].type==7){
                                    list7.push(list[i])
                                }
                                if(list[i].type==8){
                                    list8.push(list[i])
                                }
                                if(list[i].type==9){
                                    list9.push(list[i])
                                }
                                if(list[i].type==10){
                                    list10.push(list[i])
                                }

                                if(list[i].endNum==-1){
                                    aorVM.unlimitedBtn(i,list);
                                }
                            }
                            // aorVM.form.clueScorErulEdetailList1=list1;
                            // aorVM.form.clueScorErulEdetailList2=list2;
                            // aorVM.form.clueScorErulEdetailList3=list3;
                            // aorVM.form.clueScorErulEdetailList4=list4;
                            // aorVM.form.clueScorErulEdetailList5=list5;
                            // aorVM.form.clueScorErulEdetailList6=list6;
                            // aorVM.form.clueScorErulEdetailList7=list7;
                            // aorVM.form.clueScorErulEdetailList8=list8;
                            // aorVM.form.clueScorErulEdetailList9=list9;
                            // aorVM.form.clueScorErulEdetailList10=list10;
                            // aorVM.form.days1=list1[0].days+'';
                            // aorVM.form.days2=list2[0].days+'';
                            // aorVM.form.days3=list3[0].days+'';
                            // aorVM.form.days4=list4[0].days+'';
                            // aorVM.form.days5=list5[0].days+'';
                            // aorVM.form.days6=list6[0].days+'';
                            // aorVM.form.days7=list7[0].days+'';
                            // aorVM.form.days8=list8[0].days+'';
                            // aorVM.form.days9=list9[0].days+'';
                            // aorVM.form.days10=list10[0].days+'';
                            if(list1.length!=0){
                                aorVM.form.clueScorErulEdetailList1=list1;
                                if(list1[0].days){
                                    aorVM.form.days1=list1[0].days+'';
                                }
                            }
                            if(list2.length!=0){
                                aorVM.form.clueScorErulEdetailList2=list2;
                                if(list2[0].days){
                                    aorVM.form.days2=list2[0].days+'';
                                }
                            }
                            if(list3.length!=0){
                               aorVM.form.clueScorErulEdetailList3=list3; 
                                if(list3[0].days){
                                   aorVM.form.days3=list3[0].days+''; 
                                }
                            }
                            if(list4.length!=0){
                                aorVM.form.clueScorErulEdetailList4=list4;
                                if(list4[0].days){
                                    aorVM.form.days4=list4[0].days+'';
                                }
                            }
                            if(list5.length!=0){
                                aorVM.form.clueScorErulEdetailList5=list5;
                                if(list5[0].days){
                                    aorVM.form.days5=list5[0].days+'';
                                }
                            }
                            if(list6.length!=0){
                                aorVM.form.clueScorErulEdetailList6=list6;
                                if(list6[0].days){
                                    aorVM.form.days6=list6[0].days+'';
                                }
                            }                            
                            if(list7.length!=0){
                                aorVM.form.clueScorErulEdetailList7=list7;
                                if(list7[0].days){
                                    aorVM.form.days7=list7[0].days+'';
                                }
                            }
                            if(list8.length!=0){
                               aorVM.form.clueScorErulEdetailList8=list8; 
                                if(list8[0].days){
                                   aorVM.form.days8=list8[0].days+''; 
                                }
                            }
                            if(list9.length!=0){
                                aorVM.form.clueScorErulEdetailList9=list9;
                                if(list9[0].days){
                                    aorVM.form.days9=list9[0].days+'';
                                }
                            }
                            if(list10.length!=0){
                                aorVM.form.clueScorErulEdetailList10=list10;
                                if(list10[0].days){
                                    aorVM.form.days10=list10[0].days+'';
                                }
                            }

                        }else{
                            ocmVM.$message.error(msg+"失败");
                        }
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                }else{
                    this.title="新增顾问得分模型"
                    this.isEditSelect=false;
                }
            }
        },
        created(){            
            this.initBusinessline();//初始化业务线           
            this.initPageInfo();// 编辑回显
        },
        mounted(){
            document.getElementById('addOptimizeRule').style.display = 'block';
        }
    })
</script>
</html>